/*****************************************************************************
 * press_sensor.h
 *
 * Copyright (C) 2020 Jeasonvor xq1101627@163.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 ****************************************************************************/
#ifndef __PRESS_SENSOR_H__
#define __PRESS_SENSOR_H__

/*****************************************************************************
 * Included Files
 ****************************************************************************/

/*****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/

/*****************************************************************************
 * Public Types
 ****************************************************************************/

/*****************************************************************************
 * Public Data
 ****************************************************************************/

/****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
 * Public Function Prototypes
 ****************************************************************************/

/**
 * @brief:  初始化压力传感器
 *
 * @param[in]:  io_read     -   读数据回调
 * @param[in]： io_write    -   写数据回调
 *
 * @return: 成功    -   返回0
 *          失败    -   返回小于0
 * **/
int dev_press_sensor_init(int (*io_read)(unsigned char *data, unsigned int len,
                                         unsigned int timeout),
                          int (*io_write)(unsigned char *data,
                                          unsigned int   len));

/**
 * @brief:  读取传感器压力
 *
 * @param[in]:  id  -   传感器ID
 *
 * @return: 返回读取到的压力值(kPa)
 * **/
float dev_press_sensor_read(unsigned char id);

/****************************************************************************/
#ifdef __cplusplus
}
#endif
/****************************************************************************/
#endif /* __PRESS_SENSOR_H__ */
/****************************************************************************/
/*                                                                          */
/*  End of file.                                                            */
/*                                                                          */
/****************************************************************************/
